/*
* SMILParser
*
* Version 1.0
*
* Programmers: Jesse Louderback, Noah Pham, Chad Carpenter, and Marc Hindman
*/
package comm;

import java.util.ArrayList;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;

public class SMS_Sender {
	public void sendSMS(Context con, String phoneNumber, String message) {
		SmsManager sms = SmsManager.getDefault();		
		
		ArrayList<String> messages = sms.divideMessage(message); 
		int messageCount = messages.size(); 
		ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(messageCount); 
		 
		for (int j = 0; j < messageCount; j++) {
		    sentIntents.add(PendingIntent.getBroadcast(con, 0,  
		                                               new Intent(con, SMS_Sender.class), 0)); 
	    }
		sms.sendMultipartTextMessage(phoneNumber, null, sms.divideMessage(message), 
									 sentIntents, null);
	}
}
